package com.itheima.demo01.File;

import java.io.File;
import java.io.IOException;

public class Demo05File {
    public static void main(String[] args) throws IOException {
//        show01();
//        show02();
        show03();
    }

    public static void show01() throws IOException {
        File f1 = new File("D:\\Java-Code\\day08_FileAndRecursion\\1.txt");
        boolean b1 = f1.createNewFile();
        System.out.println("b1:" + b1);
        File f2 = new File("day08_FileAndRecursion\\2.txt");
        boolean b2 = f2.createNewFile();
        System.out.println("b2:" + b2);
        File f3 = new File("day08_FileAndRecursion\\新建文件夹");
        boolean b3 = f3.createNewFile();
        System.out.println("b3:" + b3);
        File f4 = new File("day08_FileAndRecur/*sion*/\\新建文件夹");
        boolean b4 = f4.createNewFile();
        System.out.println("b4:" + b4);
    }

    public static void show02() {
        File f1 = new File("day08_FileAndRecursion\\aaa");
        boolean b1 = f1.mkdir();
        System.out.println("b1:" + b1);
        File f2 = new File("day08_FileAndRecursion\\111\\222\\333\\444");
        boolean b2 = f2.mkdir();
        System.out.println("b2:" + b2);
        File f3 = new File("day08_FileAndRecursion\\111\\222\\333\\444");
        boolean b3 = f3.mkdirs();
        System.out.println("b3:" + b3);
        File f4 = new File("day08_FileAndRecursion\\abc.txt");
        boolean b4 = f4.mkdirs();
        System.out.println("b4:" + b4);
        File f5 = new File("day08_FileAndRecur/*sion*/\\ccc");
        boolean b5 = f5.mkdirs();
        System.out.println("b5:" + b5);
    }

    public static void show03() {
        File f1 = new File("day08_FileAndRecursion\\新建文件夹");
        boolean b1 = f1.delete();
        System.out.println("b1:" + b1);
        File f2 = new File("day08_FileAndRecursion\\abc.txt");
        boolean b2 = f2.delete();
        System.out.println("b2:" + b2);
    }
}
